﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Core/MP.Master" AutoEventWireup="true"
    CodeBehind="NewUser.aspx.cs" Inherits="PhotoHsn.WebApp.NewUser1" %>

<%@ Register Src="s3capcha/wucCapcha.ascx" TagName="wucCapcha" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  
     <script>
         jQuery(document).ready(function () {
             // binds form submission and fields to the validation engine
             jQuery("#masterform").validationEngine();

             $("#<%=txtUserName.ClientID %>").blur(function () {
                 $.ajax({
                     type: "POST",
                     url: "http://localhost:50136/WebServices/wsUserServices.asmx/GetUserName",
                     data: "{userName:'" + $("#<%=txtUserName.ClientID %>").val() + "'}",
                     contentType: "application/json; charset=utf-8",
                     dataType: "json",
                     success: function (response) {
                         if ($("#<%=txtUserName.ClientID %>").val() != "")
                             if (response.d == "") {
                                 $("#lUserControlSonuc").text("Kullanıcı Adı Uygun");
                                 $("#lUserControlSonuc").css("color", "Green");
                             }
                             else {
                                 $("#lUserControlSonuc").text("Kullanıcı Kullanımakta");
                                 $("#lUserControlSonuc").css("color", "Red");
                             }
                     },
                     failure: function (msg) {
                         $('#lUserControlSonuc').text(msg);
                     }
                 });
             });

             $("#<%=txtEMail.ClientID %>").blur(function () {
                 $.ajax({
                     type: "POST",
                     url: "http://localhost:50136/WebServices/wsUserServices.asmx/GetEmail",
                     data: "{email:'" + $("#<%=txtEMail.ClientID %>").val() + "'}",
                     contentType: "application/json; charset=utf-8",
                     dataType: "json",
                     success: function (response) {
                         if ($("#<%=txtEMail.ClientID %>").valid())

                             if (response.d == "") {
                                 $("#lUserControlESonuc").text("Email Uygun");
                                 $("#lUserControlESonuc").css("color", "Green");
                             }
                             else {
                                 $("#lUserControlESonuc").text("Email Kullanılmakta");
                                 $("#lUserControlESonuc").css("color", "red");
                             }

                     },
                     failure: function (msg) {
                         $("#lUserControlESonuc").text(msg);
                     }
                 });
             });
         });

         /**
         *
         * @param {jqObject} the field where the validation applies
         * @param {Array[String]} validation rules for this field
         * @param {int} rule index
         * @param {Map} form options
         * @return an error string if validation failed
         */
         function checkHELLO(field, rules, i, options) {
             if (field.val() != "HELLO") {
                 // this allows to use i18 for the error msgs
                 return options.allrules.validate2fields.alertText;
             }
         }
        </script>

    
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
   <%-- <form id="form1" runat="server" clientidmode="Static">--%>
    <fieldset class="validationGroup">
        <legend>Yeni Kullanıcı</legend>
        <table>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lUserName" runat="server" Text="Kullanıcı Adı"></asp:Literal>
                </td>
                <td>
                    <asp:TextBox ID="txtUserName" name="txtUserName" class="validate[required,minSize[4]] text-input" runat="server" MaxLength="50"></asp:TextBox>
                    <a id="lUserControlSonuc" ></a>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lPassword" runat="server" Text="Şifre"></asp:Literal>
                </td>
                <td>
                     <asp:TextBox ID="txtPassword" ClientIDMode="Static" class="validate[required,minSize[6]] text-input"  runat="server"
                         MaxLength="50" name="password" TextMode="Password"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lPasswordAgain" runat="server" Text="Şifre Tekrar"></asp:Literal>
                </td>
                <td>
                    <asp:TextBox ID="txtPasswordAgain" name="txtPasswordAgain" ClientIDMode="Static"
                       class="validate[required,equals[txtPassword]] text-input" runat="server" MaxLength="50" TextMode="Password"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lEmail" runat="server" Text="Email Adresi"></asp:Literal>
                </td>
                <td>
                    <asp:TextBox ID="txtEMail" runat="server" ClientIDMode="Static" class="validate[required,custom[email]] text-input" MaxLength="50"></asp:TextBox>
                    <a id="lUserControlESonuc"></a>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lSecQues" runat="server" Text="Güvenlik Sorusu"></asp:Literal>
                </td>
                <td>
                    <asp:DropDownList ID="ddlSecQues" runat="server" class="validate[required]">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lAnswer" runat="server" Text="Cevap"></asp:Literal>
                </td>
                <td>
                    <asp:TextBox ID="txtAnswer" runat="server" MaxLength="50"  class="validate[required] text-input" TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lAd" runat="server" Text="Ad"></asp:Literal>
                </td>
                <td>
                    <asp:TextBox ID="txtName" runat="server" MaxLength="50"  class="validate[required] text-input" ></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lMiddelName" runat="server" Text="Orta Ad"></asp:Literal>
                </td>
                <td>
                    <asp:TextBox ID="txtMiddelName" runat="server" MaxLength="50"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lLastName" runat="server" Text="Soyad"></asp:Literal>
                </td>
                <td>
                    <asp:TextBox ID="txtLastName" runat="server" MaxLength="50"  class="validate[required] text-input"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    <asp:Literal ID="lGender" runat="server" Text="Cinsiyet"></asp:Literal>
                </td>
                <td>
                    <asp:RadioButtonList ID="rblGender" runat="server">
                        <asp:ListItem Selected="True" Value="1">Bay</asp:ListItem>
                        <asp:ListItem Value="0">Bayan</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td class="fr">
                    &nbsp;
                </td>
                <td>
                    <uc1:wucCapcha ID="wucCapcha1" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="fr">
                    &nbsp;
                </td>
                <td>
                  
                </td>
            </tr>
            <tr>
                <td class="tr">
                    <asp:Button runat="server" ID="btnSender" Text="Gönder" CssClass="causesValidation"
                        OnClick="lnkBtnSubmit_Click" />
                </td>
            </tr>
        </table>
    </fieldset>
  <%--  </form>--%>
</asp:Content>
